<template>
  <div id="app">
    <ul>
      <li v-for="(product , index) in products" :key="index">
        <input v-model.number="product.quatity"> : {{ product.name}}
        <button @click="product.quatity = product.quatity + 1">add</button>
      </li>
    </ul>
    <div>total : {{ total }}</div>
  </div>
</template>

<script>

export default {
  data () {
    return {
      products: [
        {name:'jaket' , quatity:10},
        {name:'yien' , quatity:20},
        {name:'kurry' , quatity:0},
        {name:'james' , quatity:1}
      ]
    }
  },
  methods: {

  },
  computed: {
    total () {
      return this.products.reduce((sum , product) => {
          return sum += product.quatity;
      } , 0);
    }
  }
}
</script>

<style>

</style>
